<template>
    <div class="dv-border-box-7"
        style="background-color: transparent; box-shadow: #093563 0px 0px 40px inset; border: 1px solid rgba(128, 128, 128, 0.3);" ref="dom">
        <svg class="dv-border-svg-container" :width="width" :height="height">
            <polyline class="dv-bb7-line-width-2" stroke="rgba(128,128,128,0.3)" :points="`0, 25 0, 0 25, 0`" />
            <polyline class="dv-bb7-line-width-2" stroke="rgba(128,128,128,0.3)"
                :points="`${width - 25}, 0 ${width}, 0 ${width}, 25`" />
            <polyline class="dv-bb7-line-width-2" stroke="rgba(128,128,128,0.3)"
                :points="`${width - 25}, ${height} ${width}, ${height} ${width}, ${height - 25}`" />
            <polyline class="dv-bb7-line-width-2" stroke="rgba(128,128,128,0.3)"
                :points="`0, ${height - 25} 0, ${height} 25, ${height}`" />

            <polyline class="dv-bb7-line-width-5" stroke="rgb(64, 240, 255)" :points="`0, 10 0, 0 10, 0`" />
            <polyline class="dv-bb7-line-width-5" stroke="rgb(64, 240, 255)"
                :points="`${width - 10}, 0 ${width}, 0 ${width}, 10`" />
            <polyline class="dv-bb7-line-width-5" stroke="rgb(64, 240, 255)"
                :points="`${width - 10}, ${height} ${width}, ${height} ${width}, ${height - 10}`" />
            <polyline class="dv-bb7-line-width-5" stroke="rgb(64, 240, 255)"
                :points="`0, ${height - 10} 0, ${height} 10, ${height}`" />
        </svg>
        <div class="border-box-content">
            <slot></slot>
        </div>
    </div>
</template>

<script setup lang="ts">
import { nextTick, onMounted, ref, shallowRef } from 'vue';

const dom = shallowRef()
const width = ref(0)
const height = ref(0)

onMounted(() => {
    nextTick(() => {
        width.value = dom.value.clientWidth 
        height.value = dom.value.clientHeight
    })
})

</script>

<style scoped lang="less">
.dv-border-box-7 {
    position: relative;
    width: 100%;
    height: 100%;

    .dv-border-svg-container {
        position: absolute;
        top: 0px;
        left: 0px;
        width: 100%;
        height: 100%;

        &>polyline {
            fill: none;
            stroke-linecap: round;
        }
    }

    .dv-bb7-line-width-2 {
        stroke-width: 2;
    }

    .dv-bb7-line-width-5 {
        stroke-width: 5;
    }

    .border-box-content {
        position: relative;
        width: 100%;
        height: 100%;
    }
}
</style>